package com.github.gaojh.example.websocket;

import io.netty.channel.Channel;

import java.util.concurrent.ConcurrentHashMap;

/**
 * @author gaojh
 * @since 2020/4/9
 */
public class WebSocketContext {

    private static final ConcurrentHashMap<String, Channel> CHANNEL_MAP = new ConcurrentHashMap<>();


    public static void addChannel(String key, Channel channel) {
        CHANNEL_MAP.put(key, channel);
    }

    public static Channel getChannel(String key) {
        return CHANNEL_MAP.get(key);
    }

    public static void delChannel(String key){
        CHANNEL_MAP.remove(key);
    }
}
